package org.desktop.web.client.role.grid;

import java.util.ArrayList;
import java.util.List;

import org.desktop.web.client.gui.models.APagingGrid;
import org.desktop.web.client.role.grid.property.RolesProperties;
import org.desktop.web.client.role.proxy.RpcRolesProxy;
import org.desktop.web.shared.domain.entities.Role;
import org.desktop.web.shared.domain.entities.User;

import com.google.gwt.core.shared.GWT;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.loader.FilterPagingLoadConfig;
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;

public class RolesGrid extends APagingGrid<Role, FilterPagingLoadConfig, RolesProperties> {

	public RolesGrid(int pageSize, APagingGrid<?, ?, ?> childGrid,
			boolean remoteSort, APagingGrid<?, ?, ?> parent) {
		super(pageSize, childGrid, remoteSort, parent);
		// TODO Auto-generated constructor stub
	}

	public RolesGrid(int pageSize, APagingGrid<?, ?, ?> childGrid,
			boolean remoteSort) {
		super(pageSize, childGrid, remoteSort);
		// TODO Auto-generated constructor stub
	}

	public RolesGrid(int pageSize, APagingGrid<?, ?, ?> parent) {
		super(pageSize, parent);
		// TODO Auto-generated constructor stub
	}

	public RolesGrid(int pageSize, boolean remoteSort,
			APagingGrid<?, ?, ?> parent) {
		super(pageSize, remoteSort, parent);
		// TODO Auto-generated constructor stub
	}

	public RolesGrid(int pageSize) {
		super(pageSize);
		// TODO Auto-generated constructor stub
	}

	@Override
	public RolesProperties getPropertyAccess() {
		// TODO Auto-generated method stub
		return GWT.create(RolesProperties.class);
	}

	@Override
	public void initProxy() {
		setRpcProxy(new RpcRolesProxy());
	}

	@Override
	public List<ColumnConfig<Role, ?>> getColumnsConfig() {
		// TODO Auto-generated method stub
		RolesProperties properties = getPropertyAccess();
		ColumnConfig<Role, String> codRole = new ColumnConfig<Role, String>(properties.codRole(),100,"Codice");
		ColumnConfig<Role, String> descRole = new ColumnConfig<Role, String>(properties.descRole(),300,"Nome ruolo");
		List<ColumnConfig<Role, ?>> cc = new ArrayList<ColumnConfig<Role, ?>>();
		// cc.add(nameColumn);
		cc.add(codRole);
		cc.add(descRole);
		return cc;
	}

	@Override
	public ModelKeyProvider<? super Role> key() {
		// TODO Auto-generated method stub
		return getPropertyAccess().key();
	}


}
